package com.cskaoyan;

import com.cskaoyan.utils.JDBCUtils;

import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

// 改
public class UpdateJDBCDemo3 {

    public static void main(String[] args) throws SQLException, IOException {

//        System.out.println("3333333");

        // 获取连接
        Connection connection = JDBCUtils.getConnection();


//        System.out.println("44444444");

        // 获取statement对象
        Statement statement = connection.createStatement();

        // 执行SQL
        int affectedRows = statement.executeUpdate("update stu set name = '陈狗' where id = 3");

        System.out.println("affectedRows:" + affectedRows);

        JDBCUtils.closeResources(connection,statement,null);

    }
}
